#pragma once
#include "TcpServer.h"
#include "EventLoop.h"
#include "Connection.h"

class EchoServer
{
public:
    EchoServer(std::string &ip, uint16_t &port);
    ~EchoServer();

    void Handlestart();
    void HandlenewConnection(Connection *conn);

    void Handlecloseconnection(Connection *conn);
    void Handleerrorconnection(Connection *conn);
    void HandleMessage(Connection *conn, std::string& message);

    void Handlesendcomplete(Connection *conn);

    void Handleepolltimeout(EventLoop *loop);

private:
    TcpServer tcpserver_;
};